<?php

declare(strict_types=1);

/**
 * 订单接口服务中心 
 */
use Hyperf\HttpServer\Router\Router;

Router::addServer('ws', function () {
    Router::addGroup('/MicroWebSocket', function() {
        //商品优选
        Router::get('/CommodityOptimization', 'App\Controller\Ws\CommodityOptimizationController');
    });
});

//consul服务健康检查
Router::addRoute(['GET', 'POST', 'HEAD'], '/health','App\Controller\Api\IndexController@health');

//订单外部接口服务中心
Router::addGroup('/Queryapi', function() {
    Router::post('/index', [\App\Controller\Api\IndexController::class, 'serviceIndex']);
},[
    'middleware' => [
        \App\Middleware\RequestVerifyMiddleware::class
    ]
]);

//订单外部接口服务中心不需要签名
Router::addGroup('/Orderservice', function() {
    Router::post('/index', [\App\Controller\Api\IndexController::class, 'serviceUnSignatureIndex']);
});

/**
 * API接口服务中心
 */
Router::addGroup('/Api', function() {
    //上传文件
    Router::post('/upload', 'App\Controller\IndexController@upload');
    //分布式ID
    Router::get('/getSnakeId', 'App\Controller\Api\IndexController@getSnakeId');
    //获取协程
    Router::get('/getCoroutine', 'App\Controller\Api\IndexController@getCoroutine');
    //发布队列消息
    Router::get('/publishMessage', 'App\Controller\Api\IndexController@publishMessage');
    //下载文件
    Router::get('/download', 'App\Controller\Api\IndexController@download');
    Router::get('/downloadfile', 'App\Controller\Api\IndexController@downloadfile');
    //redis
    Router::get('/redis', 'App\Controller\Api\IndexController@redis');
    //获取分页数据
    Router::get('/getOrderPageList', 'App\Controller\Api\IndexController@getOrderPageList');
    //获取任务队列池
    Router::post('/getTask', 'App\Controller\Api\IndexController@getTask');
    //获取任务队列池
    Router::get('/testApi', 'App\Controller\Api\TestController@index');
    //测试
    Router::get('/deduct', 'App\Controller\Api\TestController@deduct');
    //物流
    Router::post('/OrderLogistic', [\App\Controller\Api\OrderLogisticController::class, 'serviceIndex']);
   
});

/**
 * 云仓商城中心接口服务
 */
Router::addGroup('/shop', function() {
    
    //登录、注册
    Router::addGroup('/User', function() {
        //获取图形验证码
        Router::get('/getVerifyImage', 'App\Controller\Shop\UserController@getVerifyImage');
        //登录接口
        Router::post('/UserLogin', 'App\Controller\Shop\UserController@UserLogin');
        //退出登录
        Router::post('/logout', 'App\Controller\Shop\UserController@logout');
        //注册保存接口
        Router::post('/userRegisterSave', 'App\Controller\Shop\UserController@userRegisterSave');
        //发送短信接口
        Router::post('/sendSmsCode', 'App\Controller\Shop\UserController@sendSmsCode');
        //发送短信验证
        Router::post('/verifyUser', 'App\Controller\Shop\UserController@verifyUser');
        //重置密码
        Router::post('/reSetPassword', 'App\Controller\Shop\UserController@reSetPassword');
    });
    
    //会员中心
    Router::addGroup('/Member', function() {
        Router::post('/index', 'App\Controller\Shop\MemberController@index');
        Router::post('/accountLog', 'App\Controller\Shop\MemberController@balanceChangeRecord');
        Router::post('/accountLogExport', 'App\Controller\Shop\MemberController@balanceChangeRecordExport');
    });
    
    //收货地址管理
    Router::addGroup('/address', function() {
        Router::post('/addAddress', 'App\Controller\Shop\AddressController@addAddress');
        Router::post('/editAddress', 'App\Controller\Shop\AddressController@editAddress');
        Router::post('/delUserAddress', 'App\Controller\Shop\AddressController@delUserAddress');
        Router::post('/getUserAddressList', 'App\Controller\Shop\AddressController@getUserAddressList');
        Router::post('/getAreaList', 'App\Controller\Shop\AddressController@getAreaList');
        Router::post('/getBuyerInfoList', 'App\Controller\Shop\AddressController@getBuyerInfoList');
    });
    
    //首页服务
    Router::addGroup('/index', function() {
        //获取广告位
        Router::post('/getAdvertiseList', 'App\Controller\Shop\IndexController@getAdvertiseList');
        Router::post('/getAdvertiseDetail', 'App\Controller\Shop\IndexController@getAdvertiseDetail');
		//获取推荐品牌
        Router::post('/getRecommandBrandList', 'App\Controller\Shop\IndexController@getRecommandBrandList');
        //获取所有后台接口配置数据
        Router::post('/getAllShowTopicsList', 'App\Controller\Shop\IndexController@getAllShowTopicsList');
        //秒杀列表
        Router::post('/getSeckillList', 'App\Controller\Shop\IndexController@getSeckillList');
        //秒杀商品
        Router::post('/getSeckillGoodsList', 'App\Controller\Shop\IndexController@getSeckillGoodsList');
        //商品组列表接口
        Router::post('/getGoodsGroupPageList', 'App\Controller\Shop\IndexController@getGoodsGroupPageList');
        //首页轮播图片
        Router::post('/getBannerList', 'App\Controller\Shop\IndexController@getBannerList');
        //获取商品分页列表
        Router::post('/getGoodsList', 'App\Controller\Shop\IndexController@getGoodsList');
        //查询品牌和分类
        Router::post('/getSearchClassAndBrands', 'App\Controller\Shop\IndexController@getSearchClassAndBrands');
        //获取分类
        Router::post('/getClassList', 'App\Controller\Shop\IndexController@getClassList');
        //商品详情
        Router::post('/getGoodsDetail', 'App\Controller\Shop\IndexController@getGoodsDetail');
        //立即购买
        Router::post('/placeOrder', 'App\Controller\Shop\IndexController@placeOrder');
        //计算价格
        Router::post('/getGoodsPrice', 'App\Controller\Shop\IndexController@getGoodsPrice');
        //加入购物车
        Router::post('/addGoodsCart', 'App\Controller\Shop\IndexController@addGoodsCart');
        //获取其他导航栏接口
        Router::post('/getShopHomeGroupConfig', 'App\Controller\Shop\IndexController@getShopHomeGroupConfig');
        //获取其他导航栏详情接口
        Router::post('/getShopHomeGroupConfigDetail','App\Controller\Shop\IndexController@getShopHomeGroupConfigDetail');
    });
    
    //个人订单服务中心
    Router::addGroup('/Order', function() {
        Router::post('/orderSupplierList', 'App\Controller\Shop\OrderController@orderSupplierList');
        Router::post('/orderInfo', 'App\Controller\Shop\OrderController@orderInfo');
        Router::post('/orderCancel', 'App\Controller\Shop\OrderController@orderCancel');
        Router::post('/orderAfterSale', 'App\Controller\Shop\OrderController@orderAfterSale');
        Router::post('/placeOrderDetail', 'App\Controller\Shop\OrderController@placeOrderDetail');
        Router::post('/orderPay', 'App\Controller\Shop\OrderController@orderPay');
        Router::post('/orderRecharge', 'App\Controller\Shop\OrderController@orderRecharge');
        Router::post('/orderRechargePageList', 'App\Controller\Shop\OrderController@orderRechargePageList');
        Router::post('/placeOrder', 'App\Controller\Shop\OrderController@placeOrder');
        Router::post('/getOrderPayResult', 'App\Controller\Shop\OrderController@getOrderPayResult');
        Router::post('/alinOrderPayResult','App\Controller\Shop\OrderController@alinOrderPayResult');
        Router::post('/getAlinPayRechargeResult','App\Controller\Shop\OrderController@getAlinPayRechargeResult');
        Router::post('/orderPrePayInfo','App\Controller\Shop\OrderController@orderPrePayInfo');
        Router::post('/queryOrderSupplierList','App\Controller\Shop\OrderController@queryOrderSupplierList');
        Router::post('/userOrderExport','App\Controller\Shop\OrderController@userOrderExport');
    });
    
    //购物车
    Router::addGroup('/Cart', function() {
        Router::post('/index', 'App\Controller\Shop\CartController@index');
        Router::post('/removeCartGoods', 'App\Controller\Shop\CartController@removeCartGoods');
        Router::post('/orderCartGoods', 'App\Controller\Shop\CartController@orderCartGoods');
        Router::post('/cartGoodsChange', 'App\Controller\Shop\CartController@cartGoodsChange');
        Router::post('/getCardGoodsPriceByCardIds', 'App\Controller\Shop\CartController@getCardGoodsPriceByCardIds');
    });
    
    //海关查验
    Router::addGroup('/Realtimedata', function() {
        Router::addRoute(['GET', 'POST', 'HEAD'], '/receive','App\Controller\Shop\RealtimedataController@receive');
        Router::addRoute(['GET', 'POST', 'HEAD'], '/receivedata','App\Controller\Shop\RealtimedataController@receivedata');
    });

    //订购人管理
    Router::addGroup('/MerchantBuyer', function() {
        Router::post('/index', 'App\Controller\Shop\MerchantBuyerController@index');
        Router::post('/insert', 'App\Controller\Shop\MerchantBuyerController@insert');
        Router::post('/update', 'App\Controller\Shop\MerchantBuyerController@update');
        Router::post('/delete', 'App\Controller\Shop\MerchantBuyerController@delete');
    });
    
},[
    'middleware' => [
        \App\Middleware\RequestShopApiMiddleware::class,
        \App\Middleware\CorsMiddleware::class,
    ]
]);

//默认favicon.io
Router::get('/favicon.ico', function () {
    return '';
});
